package com.wanmait.recruitment.controller;

import com.wanmait.recruitment.pojo.ExRequire;
import com.wanmait.recruitment.service.ExRequireService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("manage/require")
public class RequireListController {
    @Resource
    private ExRequireService exRequireService;
    @RequestMapping("list")
    public void require(Model model){
        List<ExRequire> exRequires = exRequireService.findAll();
        model.addAttribute("exRequires",exRequires);
    }
    @RequestMapping("del")
    @ResponseBody
    public void del(String id){
        exRequireService.delete(Integer.parseInt(id));
    }
    @RequestMapping("insert")
    @ResponseBody
    public void insert(ExRequire exRequire){
        exRequireService.insert(exRequire);
    }
    @RequestMapping("update")
    @ResponseBody
    public void update(ExRequire exRequire){
        exRequireService.update(exRequire);
    }
}
